﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Electrical;
using YArchitech.Revit;
using YArchitech.Revit.Electric.Common;

namespace HYRElectric.PowerSystem
{
	internal class ElectricSystemCommand
	{
		public static void AddShardParameters(Document doc, FamilyInstance panel, ElectricalSystem eleSys)
		{
			Dictionary<string, ParameterType> dictionary = new Dictionary<string, ParameterType>();
            dictionary.Add("导线截面", (ParameterType)1);
            dictionary.Add("敷设方式", (ParameterType)1);
            dictionary.Add("穿管类型", (ParameterType)1);
            dictionary.Add("开关名称", (ParameterType)1);
            dictionary.Add("开关规格", (ParameterType)1);
            dictionary.Add("开关型号", (ParameterType)1);
            dictionary.Add("穿管管径", (ParameterType)143);
            dictionary.Add("导线类型", (ParameterType)1);
            dictionary.Add("功率因数", (ParameterType)3);
			foreach (KeyValuePair<string, ParameterType> keyValuePair in dictionary)
			{
				if (panel.GetParameter(keyValuePair.Key) == null)
				{
					SharedParameter.InsertSharedParameter(doc, BuiltInCategory.OST_ElectricalEquipment, "电气数据", dictionary, true);
					break;
				}
			}
			Dictionary<string, ParameterType> dictionary2 = new Dictionary<string, ParameterType>();
            dictionary2.Add("导线截面", (ParameterType)1);
            dictionary2.Add("敷设方式", (ParameterType)1);
            dictionary2.Add("穿管类型", (ParameterType)1);
            dictionary2.Add("开关名称", (ParameterType)1);
            dictionary2.Add("开关规格", (ParameterType)1);
            dictionary2.Add("开关型号", (ParameterType)1);
            dictionary2.Add("穿管管径", (ParameterType)143);
			foreach (KeyValuePair<string, ParameterType> keyValuePair2 in dictionary2)
			{
				if (eleSys.GetParameter(keyValuePair2.Key) == null)
				{
					SharedParameter.InsertSharedParameter(doc, BuiltInCategory.OST_ElectricalCircuit, "电气数据", dictionary2, true);
					break;
				}
			}
		}
	}
}
